zip list to dictionary python

42

Dictionary convert 2 lists into a dictionary, use zip() -

# convert 2 lists into a dictionary, use zip()

aa = [1, 2, 3]
bb = ["a", "b", "c"]

print(dict(zip(aa, bb)))
# {1: 'a', 2: 'b', 3: 'c'}

Comments

Submit
0 Comments